#!/bin/zsh

# Change the file name to the name of your PKG
installer_path="/usr/local/etc/FileWaveInstallers/SentinelOne/SentinelAgent-XXX.pkg"

# Check if SentinelOne Agent is installed
if [ -x "/usr/bin/sentinelctl" ]; then
    echo "SentinelOne Agent detected. Running upgrade..."
    sudo /usr/bin/sentinelctl upgrade-pkg "$installer_path"
else
    echo "SentinelOne Agent not found. Installing fresh package..."
    sudo /usr/sbin/installer -pkg "$installer_path" -target /
fi

exit 0